package IC.Parser;

import java_cup.runtime.Symbol;


public class Token extends Symbol {

	private int line;
	private boolean val_exist=false;
	public Token(int id, int line) {
    	super(id, ++line, 0);
    }
    
    public Token(int id, int line, String value) {
        super(id, ++line, 0, value);
    }

	public int getId() {return super.sym;}

	public Object getValue() {return super.value;}

	public int getLine() {return this.line;}

	public void setValue(Object o) {super.value = o;}

	public String toString() {
		if (!val_exist) return  this.line+ 1+ ": " +numToToken(super.sym)   ;
		else return this.line+1+": " +numToToken(super.sym)+"("+ super.value+")";
	}

	private String numToToken(int id){

		switch (id){
		case 1: return "LP"; 
		case 2: return "RP"; 
		case 3: return "ASSIGN"; 
		case 4: return "BOOLEAN"; 
		case 5: return "BREAK"; 
		case 6: return "CLASS"; 
		case 7: return "CLASS_ID"; 
		case 8: return "COMMA"; 
		case 9: return "CONTINUE"; 
		case 10: return "DIVIDE"; 
		case 11:return "DOT";
		case 12: return "EQUAL"; 
		case 13: return "EXTENDS"; 
		case 14: return "ELSE"; 
		case 15: return "FALSE"; 
		case 16: return "GT"; 
		case 17: return "GTE"; 
		case 18: return "ID"; 
		case 19: return "IF"; 
		case 20: return "INT"; 
		case 21: return "INTEGER"; 
		case 22: return "LAND"; 
		case 23:return "LB";
		case 24: return "LCBR"; 
		case 25: return "LENGTH"; 
		case 26: return "NEW"; 
		case 27: return "LNEG"; 
		case 28: return "LOR"; 
		case 29: return "LT"; 
		case 30: return "LTE"; 
		case 31: return "MINUS"; 
		case 32: return "MOD"; 
		case 33: return "MULTIPLY"; 
		case 34: return "NEQUAL"; 
		case 35: return "NULL"; 
		case 36: return "PLUS"; 
		case 37:return "RB"; 
		case 38: return "RCBR"; 
		case 39: return "RETURN"; 
		case 40: return "SEMI"; 
		case 41: return "STATIC"; 
		case 42: return "STRING";
		case 43: return "QUOTE"; 
		case 44: return "THIS"; 
		case 45: return "TRUE"; 
		case 46: return "VOID"; 
		case 47: return "WHILE"; 
		case 0: return "EOF"; 
		default:return "Error";
		}



	}
}

